class Solution
{
public:
    int countMatches(vector<vector<string>> &items, string ruleKey, string ruleValue)
    {
        int rule = 0;
        if (ruleKey == "color")
        {
            rule = 1;
        }
        else if (ruleKey == "name")
        {
            rule = 2;
        }
        int count = 0;
        for (auto &item : items)
        {
            if (item[rule] == ruleValue)
            {
                ++count;
            }
        }
        return count;
    }
};